package com.itheima.edu.info.manager.controller;

import com.itheima.edu.info.manager.domain.Student;
import com.itheima.edu.info.manager.service.StudentService;

import java.util.Scanner;

public class OtherStduentController extends BaseStduentController{
    Scanner sc=new Scanner(System.in);
    StudentService studentService=new StudentService();
    public void updateStudent() {
       // Scanner sc=new Scanner(System.in);
        System.out.println("请输入您要修改的学生学号：");
        while(true){
            String sid = sc.next();
            boolean flag = studentService.isExists(sid);
            if(!flag){
                System.out.println("您输入的学号不存在，请重新输入");
            } else{
                System.out.println("请输入新的学生姓名：");
                String name = sc.next();
                System.out.println("请输入新的学生年龄：");
                String age = sc.next();
                System.out.println("请输入新的学生生日：");
                String birthday = sc.next();
                Student student = new Student(sid,name,age,birthday);
                studentService.updataStudent(student,sid);
                System.out.println("修改成功");
                break;
            }
        }
    }
}
